package com.crawler.waf.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.crawler.waf.security.authentication.PreAuthenticatedAuthenticationExtractorManager;
import com.crawler.waf.security.services.UserDetailsService;
import com.crawler.waf.security.services.TokenService;
import com.crawler.waf.security.services.impl.UserCenterBearerTokenCacheService;
import com.crawler.waf.security.services.impl.UserCenterMacTokenCacheService;
import com.crawler.waf.security.services.impl.UserCenterUserDetailsCacheService;

@Configuration
public class WafSecurityConfig {

    @Bean
    public PreAuthenticatedAuthenticationExtractorManager preAuthenticatedAuthenticationExtractorManager(){
            return new PreAuthenticatedAuthenticationExtractorManager();
    }

    @Bean
    public UserDetailsService userDetailsService() {
        return new UserCenterUserDetailsCacheService();
    }

    @Bean(name = {"mac_token_service"})
    public TokenService getMacTokenService() {
        return new UserCenterMacTokenCacheService();
    }

    @Bean(name = {"bearer_token_service"})
    public TokenService getBearerTokenService() {
        return new UserCenterBearerTokenCacheService();
    }

}
